<?php
	echo $this->Html->script('jquery');
	$this->Paginator->options(array(
			'update' => '#content',
			'evalScripts' => true,
			'before' => $this->Js->get('#busy-indicator')->effect('fadeIn', array('buffer' => false)),
			'complete' => $this->Js->get('#busy-indicator')->effect('fadeOut', array('buffer' => false)),
	));
?>

<div class="items index">
	<h2><?php echo __('Items');?></h2>
	
	<?php
		$options = array('ITIN','Name','Status','Expiry <=','Expiry >=','Description','Any Text');
		$clear = !is_null($this->Session->read('Item.search_data'));
		$this->QuickSearch->makeQuickSearch($options, $clear);
	?>
	
	<table cellpadding="0" cellspacing="0">
	<tr>
		<th><?php echo $this->Paginator->sort('id','ITIN');?></th>
		<th><?php echo $this->Paginator->sort('name');?></th>
		<th><?php echo $this->Paginator->sort('status');?></th>
		<th><?php echo $this->Paginator->sort('expiry');?></th>
		<th><?php echo $this->Paginator->sort('description');?></th>
		<th class="actions"><?php echo __('Actions');?></th>
	</tr>
<?php foreach ($items as $item): ?>
	<tr>
		<td><?php echo h($item['Item']['id']); ?>&nbsp;</td>
		<td><?php echo h($item['Item']['name']); ?>&nbsp;</td>
		<td><?php echo h($item['Item']['status']); ?>&nbsp;</td>
		<td><?php echo h($item['Item']['expiry']); ?>&nbsp;</td>
		<td><?php echo h($item['Item']['description']); ?>&nbsp;</td>
		<td class="actions">
			<?php echo $this->Html->link(__('View'), array('action' => 'view', $item['Item']['id'])); ?>
			<?php echo $this->Html->link(__('Edit'), array('action' => 'edit', $item['Item']['id'])); ?>
			<?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $item['Item']['id']), null, __('Are you sure you want to delete # %s?', $item['Item']['id'])); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>

	<div class="paging">
	<?php
		echo $this->Paginator->prev('< ' . __('previous'), array(), null, array('class' => 'prev disabled'));
		echo $this->Paginator->numbers(array('separator' => ''));
		echo $this->Paginator->next(__('next') . ' >', array(), null, array('class' => 'next disabled'));
	?>
	</div>
</div>
<?php echo $this->Js->writeBuffer(); ?>